home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / libcs / salloc.c < prev    next >
C/C++ Source or Header  |  1995-06-12  |  2KB  |  56 lines

  1. /*
  2.  * Copyright (c) 1990 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * THE SOFTWARE IS PROVIDED "AS IS" AND CARNEGIE MELLON UNIVERSITY
  12.  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  13.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT
  14.  * SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, DIRECT,
  15.  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  17.  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  *
  20.  * Users of this software agree to return to Carnegie Mellon any
  21.  * improvements or extensions that they make and grant Carnegie the
  22.  * rights to redistribute these changes.
  23.  *
  24.  * Export of this software is permitted only after complying with the
  25.  * regulations of the U.S. Deptartment of Commerce relating to the
  26.  * Export of Technical Data.
  27.  */
  28. /*
  29.  **********************************************************************
  30.  * HISTORY
  31.  * $Log:    salloc.c,v $
  32.  * Revision 1.3  90/12/11  17:58:18  mja
  33.  *     Add copyright/disclaimer for distribution.
  34.  * 
  35.  * 09-Apr-87  Glenn Marcy (gm0w) at Carnegie-Mellon University
  36.  *    Changed to save length and use bcopy instead of strcpy.
  37.  *
  38.  * 02-Nov-85  Glenn Marcy (gm0w) at Carnegie-Mellon University
  39.  *    Created from routine by same name in Steve Shafer's sup program.
  40.  *
  41.  **********************************************************************
  42.  */
  43. char *malloc();
  44.  
  45. char *salloc(p)
  46. char *p;
  47. {
  48.     register char *q;
  49.     register int l;
  50.  
  51.     q = malloc(l = strlen(p) + 1);
  52.     if (q != 0)
  53.         bcopy(p, q, l);
  54.     return(q);
  55. }
  56.